import request from '@/utils/request'

const api_name = '/eduservice/course'

export default {
  //1 添加课程
  saveCourseInfo(courseInfo) {
    return request({
      url: `${api_name}/addCourseInfo`,
      method: 'post',
      data: courseInfo
    })
  },
  //2 获取课程详情
  getCourseInfoById(id) {
    return request({
      url: `${api_name}/getCourseInfo/${id}`,
      method: 'get'
    })
  },
  //3 更新课程
  updateCourseInfo(courseInfo) {
    return request({
      url: `${api_name}/updateCourseInfo`,
      method: 'post',
      data: courseInfo
    })
  },
  //4. 根据课程id获取最终发布结果
  getCoursePublishInfoById(id) {
    return request({
      url: `${api_name}/getCoursePublishVoById/${id}`,
      method: 'get'
    })
  },
  //5. 发布课程
  publishCourse(id) {
    return request({
      url: `${api_name}/publishCourse/${id}`,
      method: 'put'
    })
  },
  //6. 条件查询带分页
  getPageList(page, limit, searchObj) {
    return request({
      url: `${api_name}/pageListCourseCondition/${page}/${limit}`,
      method: 'get',
      params: searchObj
    })
  },
  //7. 删除课程
  removeById(courseId){
    return request({
      url: `${api_name}/${courseId}`,
      method: 'delete',
    })
  }
}
